package com.itheima;

import java.io.IOException;

/*
快速入门方法
 */
public class MybatisDemo {
    public static void main(String[] args) throws IOException {
/*        //1.加载核心配置文件，获取SqlSessionFactory
        String resource = "mybatis-config.xml";
        InputStream inputStream = Resources.getResourceAsStream(resource);
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);

        //2.获取SqlSession对象，用它来执行sql
        SqlSession sqlSession = sqlSessionFactory.openSession();

        //3.执行sql
        List<User> users = sqlSession.selectList("test.selectAll");

        System.out.println(users);

        //4.释放资源
        sqlSession.close();*/
        boolean flag = isPalindrome(121);
        System.out.println(flag);
    }

    public static boolean  isPalindrome(int x) {
        if(x<0){
            return false;
        }
        String s = x+"";
        StringBuilder sb = new StringBuilder(s);
        if(sb.reverse().toString().equals(s)){
            return true;
        }else {
            return false;
        }
    }
}
